package com.lms.lambda;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * @Author: 李孟帅
 * @CreateTime: 2020-05-12 07:49
 * @Description: ${Description}
 */
public class ConsumerDemo {
    public static void main(String[] args) {

        Consumer<String> consumer=s-> System.out.println(s);// 可以使用方法引用：Consumer<String> consumer= System.out::println
        consumer.accept("你好");

        Consumer<String> andThen = consumer.andThen(s -> System.out.println(s + 000)); //按顺序执行消费
        andThen.accept("111");

//        default Consumer<T> andThen(Consumer<? super T> after) {
//            Objects.requireNonNull(after);
//            return (T t) -> { accept(t); after.accept(t); };
//        }

    }
}
